package com.atguigu.demo.config;

import com.atguigu.demo.entity.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class TigerControllerAdvice {

    public static final int GLOBAL_ERROR_CODE = 55555;

    @ExceptionHandler(value = Exception.class)
    public Result<Void> globalExceptionHandler(Exception e) {
        return Result.failed(GLOBAL_ERROR_CODE, e.getMessage());
    }

}
